Skip to content

Add wstd::main and wstd::test macros for WASIp3 - #149

Open
adamrk wants to merge 6 commits into
bytecodealliance:mainfrom
adamrk:abk/main-macro-for-wasip3
Open

Add wstd::main and wstd::test macros for WASIp3#149
adamrk wants to merge 6 commits into
bytecodealliance:mainfrom
adamrk:abk/main-macro-for-wasip3

Conversation

@adamrk

@adamrk adamrk commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Based on #146

Addresses #148

use wstd::http::{Body, Client, Request, error::ErrorCode};

#[wstd::main]
#[wstd::test]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A drive-by fix. This test wasn't actually running under cargo test because it used the main macro.

@adamrk
adamrk force-pushed the abk/main-macro-for-wasip3 branch from af9bae0 to cabda1f Compare September 3, 2026 14:25
Comment thread .cargo/config.toml
# * AWS auth environment variables, for running the wstd-aws integration tests.
# * . directory is available at .
runner = "wasmtime run -Shttp --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_SESSION_TOKEN --dir .::."
runner = "wasmtime run -Sp3 -Shttp --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_SESSION_TOKEN --dir .::."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transition to using wasm32-wasip3 target should mean we have a separate section with this changed runner, and can exclude p3 stuff on the p2 target

Comment thread macro/src/lib.rs
::core::unreachable!(
"wstd p3 components run via the wasi:cli/run@0.3.0 export, not `main`"
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this breaks in wasm32-wasip3 target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants